from flask import Flask, jsonify, render_template
import psutil

app = Flask(__name__)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/status')
def status():
    cpu_usage = psutil.cpu_percent(interval=1)
    memory_info = psutil.virtual_memory()
    memory_usage = memory_info.percent

    return jsonify({'cpu_usage': cpu_usage, 'memory_usage': memory_usage})


if __name__ == '__main__':
    app.run(debug=True)